
import org.apache
import org.apache.spark.sql.SparkSession
object soso {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession
      .builder
      .master("local[*]")
      .appName("spark")
      .getOrCreate()
    val sc = spark.sparkContext
    val first_half =
      sc.textFile("C:\\Users\\Administrator\\Desktop\\Employee_salary_first_half.csv")
    val drop_first =
      first_half.mapPartitionsWithIndex((ix,it) => {
        if (ix ==0) it.drop(1)
        it
      })
    val split_first = drop_first.map(line => {val data =
      line.split(",");
      (data(1),data(6).toLongOption)})
    val sort_first = split_first.sortBy(x => x._2,false)
    sort_first.take(3).foreach(println)

  }


}
